From 8e6ffa5cb534ae50b27c79cd64a083772c84c8d1 Mon Sep 17 00:00:00 2001 From: Karol Kuczmarski Date: Sat, 13 May 2017 17:00:52 +0100 Subject: [PATCH] Document the feature --- src/doc/build-script.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/doc/build-script.md b/src/doc/build-script.md index 586dd29f0..b747ed0c0 100644 --- a/src/doc/build-script.md +++ b/src/doc/build-script.md @@ -51,6 +51,7 @@ All the lines printed to stdout by a build script are written to a file like `ta cargo:rustc-link-lib=static=foo cargo:rustc-link-search=native=/path/to/foo cargo:rustc-cfg=foo +cargo:rustc-env=FOO=bar # arbitrary user-defined metadata cargo:root=/path/to/foo cargo:libdir=/path/to/foo/lib @@ -73,6 +74,12 @@ crate is built: * `rustc-cfg=FEATURE` indicates that the specified feature will be passed as a `--cfg` flag to the compiler. This is often useful for performing compile-time detection of various features. +* `rustc-env=VAR=VALUE` indicates that the specified environment variable + will be added to the environment which the compiler is run within. + The value can be then retrieved by the `env!` macro in the compiled crate. + This is useful for embedding additional metadata in crate's code, + such as the hash of Git HEAD or the unique identifier of a continuous + integration server. * `rerun-if-changed=PATH` is a path to a file or directory which indicates that the build script should be re-run if it changes (detected by a more-recent last-modified timestamp on the file). Normally build scripts are re-run if -- 2.30.2